﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace FlashPay.Admin.Controllers
{
    using FlashPay.Entity;
    using FlashPay.Entity.Enum;
    using FlashPay.Entity.Request.User;
    using FlashPay.Entity.Response.Sys;
    using FlashPay.Entity.Response.User;
    using FlashPay.Service.Interface;
    using FlashPay.Util;
    using Microsoft.AspNetCore.Http;

    /// <summary>
    /// 系统语言控制器
    /// </summary>
    public class SysLanguageController : BaseController
    {
        #region 注入
        /// <summary>
        /// 授权业务接口
        /// </summary>
        private readonly AuthorizeService _authorizeService;

        /// <summary>
        /// 菜单业务接口
        /// </summary>
        private readonly MenuService _menuService;

        /// <summary>
        /// 用户业务接口
        /// </summary>
        private readonly UserInfoService _userInfoService;

        /// <summary>
        /// 注入
        /// </summary>
        /// <param name="menuService"></param>
        /// <param name="authorizeService"></param>
        /// <param name="userInfoService"></param>
        public SysLanguageController(IAuthenticate<TicketResponse> _manage, IHttpContextAccessor _accessor, AuthorizeService authorizeService, MenuService menuService, UserInfoService userInfoService) : base(_manage, _accessor)
        {
            _authorizeService = authorizeService;
            _menuService = menuService;
            _userInfoService = userInfoService;
        }
        #endregion

        /// <summary>
        /// 获取
        /// </summary>
        [AuthorizeFilter(AuthCode.SysLanguage0001)]
        public JsonResult GetPageTypes()
        {
            var response = new JResult<List<PageTypesResponse>>()
            {
                Success = true
            };


            var pageTypes = EnumUtil.ToDictionary(typeof(PageTypes));

            var list = new List<PageTypesResponse>();
            foreach (var item in pageTypes) {
                list.Add(new PageTypesResponse() {
                    Id = item.Key,
                    Name = item.Value
                });
            }
            response.Data = list;

            return Json(response);
        }
    }
}